<style>
ul.brandmenu { margin-bottom:20px;height:50px; }
	ul.brandmenu li { height:50px; }
		ul.brandmenu li a, ul.brandmenu li a:hover, ul.brandmenu li a:visited { display:block;height:50px;line-height:50px;font-size:20px;font-weight:bold;width:100%;padding:0px; }
			ul.brandmenu li ul { display:none;z-index:999999999;width:100%; }
				ul.brandmenu li:hover ul { display:block;position:relative;top:-100px;left:240px;width:100%;padding:10px;background:#ffffff;z-index:999999999;border:#cccccc 1px solid;border-radius:10px;-moz-border-radius:10px;-webkit-border-radius:10px;zoom:1; }
					ul.brandmenu li:hover ul li { height:30px; }
						ul.brandmenu li:hover ul li a, ul.brandmenu li:hover ul li a:visited { display:block;height:30px;width:97%;padding-left:3%;font-size:12px;font-weight:normal;color:#263692;line-height:30px; }
							ul.brandmenu li:hover ul li a:hover { background:#f2f2f2;font-weight:bold; }
					ul.brandmenu li:hover ul ul { display:none;z-index:999999999;width:100%; }
						ul.brandmenu li:hover ul li:hover ul { display:block;position:relative;top:-50px;left:180px;width:140%;padding:10px;background:#ffffff;z-index:999999999;border:#cccccc 1px solid;border-radius:10px;-moz-border-radius:10px;-webkit-border-radius:10px;zoom:1; }
							ul.brandmenu li:hover ul li:hover ul li { height:60px;zoom:1; }
								ul.brandmenu li:hover ul li:hover ul a { height:40px;line-height:40px;padding-top:10px;padding-bottom:10px; }
</style>

<ul class="brandmenu">
	<li><a href="http://www.siliconsolar.com/shop-by-brand/" class="button">Shop By Brand</a>
    	<ul>
<?php
	$brandpagelone = new WP_Query('post_type=page&post_parent=27221&posts_per_page=-1&orderby=menu_order'); ?>
	<?php while ($brandpagelone->have_posts()) : $brandpagelone->the_post(); ?>
    	
        <?php $childpageloneid = get_the_ID(); ?>
        <li>
        	<a href="<?php the_permalink(); ?>">
        		<?php
					$banned = 'By Brand';
					$brandtitle = get_the_title();
					$nobrandtitle   = str_ireplace($banned, ' ', $brandtitle);
					echo $nobrandtitle;
				?>
        	</a>
        		<?php $brandpageltwo = new WP_Query('post_type=page&post_parent='.$childpageloneid.'&posts_per_page=-1&orderby=menu_order'); ?>
                <?php if ($brandpageltwo->have_posts()) { ?>
                	<ul>
            		<?php while ($brandpageltwo->have_posts()) : $brandpageltwo->the_post(); ?>
            			<?php $productbrandimage = get_post_meta($post->ID, 'productbrandimage', true); ?>
            			<li>
                			<a href="<?php the_permalink(); ?>">
                                        <?php if(get_post_meta($post->ID, 'productbrandimage', true)) { ?>
                                            <img class="attachment-shop_catalog wp-post-image" src="/../<?php echo $productbrandimage ; ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" width="40" height="40" style="float:left;margin:0px;margin-right:20px;border:0px;width:40px;height:40px;" />
                                        <?php } else { ?>
                                            <img class="attachment-shop_catalog wp-post-image" src="/../wp-content/themes/siliconsolar/images/siliconsolar-logo300.jpg" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" width="40" height="40" style="float:left;margin:0px;margin-right:20px;border:0px;width:40px;height:40px;" />
                                        <?php } ?>
                                <?php the_title(); ?>
                    		</a>
                        	<div style="width:100%;height:0px;clear:both;"></div>
                		</li>
            		<?php endwhile ?>
                	</ul>
                <?php } ?>
            	<?php wp_reset_postdata(); ?>
		</li>
        
    <?php endwhile ?>
<?php wp_reset_postdata(); ?>
		</ul>
	</li>
</ul>